##Libraries
library(tidyverse)
[30m── [1mAttaching packages[22m ───────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──[39m
[30m[32m✔[30m [34mggplot2[30m 2.2.1.[31m9000[30m [32m✔[30m [34mpurrr [30m 0.2.5
[32m✔[30m [34mtibble [30m 1.4.2 [32m✔[30m [34mdplyr [30m 0.7.5
[32m✔[30m [34mtidyr [30m 0.8.1 [32m✔[30m [34mstringr[30m 1.3.1
[32m✔[30m [34mreadr [30m 1.1.1 [32m✔[30m [34mforcats[30m 0.3.0 [39m
[30m── [1mConflicts[22m ──────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
[31m✖[30m [34mtidyr[30m::[32mexpand()[30m masks [34mMatrix[30m::expand()
[31m✖[30m [34mdplyr[30m::[32mfilter()[30m masks [34mstats[30m::filter()
[31m✖[30m [34mdplyr[30m::[32mlag()[30m masks [34mstats[30m::lag()[39m
library(lme4)
library(lmerTest)
library(jtools)
The most recent jtools update (to 1.0.0) was a major update. Please check out
http://www.jtools.jacob-long.com/news/ for details on what is new. This message will go away in 3
days.
library(lcmm)
Loading required package: survival
Attaching package: ‘lcmm’
The following objects are masked from ‘package:lme4’:
fixef, ranef
##Parameters
intervention_file <- "~/Desktop/BABIES/manber_sleep/ID and Tx Arm.csv"
plot_trajectories_id <- function(dataframe, x, y) {
x_variable = enquo(x)
y_variable = enquo(y)
dataframe %>%
ggplot(aes(!! x_variable, !! y_variable)) +
geom_jitter() +
geom_smooth(
aes(color = as.factor(ID)),
method = "lm",
se = FALSE,
alpha = 1/2
) +
geom_smooth(
method = "lm",
se = FALSE,
color = "black",
size = 2
) +
theme_minimal() +
theme(
legend.position = "none"
)
}
plot_trajectories <- function(dataframe, x, y, color, method) {
x_variable = enquo(x)
y_variable = enquo(y)
color_variable = enquo(color)
dataframe %>%
ggplot(aes(x = !! x_variable, y = !! y_variable, color = !! color_variable)) +
geom_jitter() +
geom_smooth(
method = method,
se = FALSE,
size = 2
) +
theme_minimal()
}
data_wf <-
free_play_wf %>%
left_join(free_play_fa %>% select(ID, Factor1:Factor3), by = "ID") %>%
left_join(read_csv(intervention_file), by = "ID") %>%
left_join(questionnaires, by = "ID") %>%
left_join(maternal_actigraphy_summary, by = "ID")
Parsed with column specification:
cols(
ID = col_integer(),
Condition = col_character()
)
data_lf <-
free_play_lf %>%
filter(Episode != 6) %>%
left_join(read_csv(intervention_file), by = "ID") %>%
left_join(questionnaires, by = "ID") %>%
left_join(maternal_actigraphy_summary, by = "ID") %>%
mutate(
episode_re = as.integer(
recode(
Episode,
"1" = "0",
"2" = "1",
"3" = "2",
"4" = "3",
"5" = "4"
)
),
wake_time_grp = if_else(
mean_wake_time > 60,
"higher", "lower"
),
efficiency_grp = if_else(
mean_efficiency > median(mean_efficiency, na.rm = TRUE),
"higher", "lower"
),
ISI_grp = if_else(
ISI_total > median(ISI_total, na.rm = TRUE),
"higher", "lower"
),
ISIP_grp = if_else(
ISI_total > median(ISIP_total, na.rm = TRUE),
"higher", "lower"
)
)
Parsed with column specification:
cols(
ID = col_integer(),
Condition = col_character()
)
glimpse(data_wf)
Observations: 67
Variables: 127
$ ID <dbl> 11002, 11004, 11016, 11017, 11021, 11022, 11023, 11025, ...
$ `1_detach_fin` <dbl> 1.0, 1.0, 1.0, 1.0, 1.0, 1.5, 3.5, 1.0, 1.0, 1.0, 1.5, 1...
$ `1_intrus_fin` <dbl> 3.5, 2.0, 5.0, 6.0, 2.0, 2.0, 3.0, 4.5, 4.0, 2.0, 2.0, 3...
$ `1_negreg_fin` <dbl> 1.0, 1.0, 1.5, 1.0, 1.0, 1.0, 1.5, 1.0, 1.0, 1.0, 1.0, 1...
$ `1_posreg_fin` <dbl> 5.5, 6.0, 5.0, 6.0, 3.0, 6.0, 4.0, 5.5, 6.0, 5.0, 5.5, 4...
$ `1_sens_fin` <dbl> 4.0, 4.5, 3.5, 2.5, 4.0, 5.0, 3.0, 3.5, 3.5, 5.0, 4.0, 4...
$ `1_stim_fin` <dbl> 3.5, 3.0, 3.0, 3.0, 2.0, 3.5, 2.0, NA, 3.5, 2.5, 2.0, 5....
$ `2_detach_fin` <dbl> 1.0, 1.0, 1.5, 1.0, 1.0, 1.0, 3.0, 1.5, 1.0, 1.0, 1.0, 1...
$ `2_intrus_fin` <dbl> 5.0, 2.5, 5.5, 5.5, 1.5, 2.5, 4.5, 3.5, 5.0, 2.0, 2.5, 3...
$ `2_negreg_fin` <dbl> 1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 2.0, 1.0, 2.5, 1.0, 1.0, 2...
$ `2_posreg_fin` <dbl> 6.0, 6.0, 4.5, 6.0, 3.5, 5.5, 4.0, 5.0, 5.0, 6.0, 6.0, 4...
$ `2_sens_fin` <dbl> 3.5, 5.0, 3.0, 3.0, 4.0, 5.0, 3.0, 3.0, 3.0, 6.0, 4.0, 4...
$ `2_stim_fin` <dbl> 4.0, 4.5, 2.0, 3.5, 2.5, 3.5, 3.0, NA, 3.0, 4.0, 3.0, 5....
$ `3_detach_fin` <dbl> 1.0, 1.5, 1.0, 1.0, 1.0, 1.0, 2.5, 1.0, 1.0, 1.0, 1.0, 1...
$ `3_intrus_fin` <dbl> 6.0, 6.0, 4.5, 5.5, 1.0, 2.5, 4.5, 3.0, 5.0, 1.0, 1.5, 2...
$ `3_negreg_fin` <dbl> 1.5, 1.0, 1.5, 1.5, 1.0, 1.0, 2.0, 1.0, 2.0, 1.0, 1.0, 1...
$ `3_posreg_fin` <dbl> 5.0, 6.0, 5.0, 5.0, 3.5, 5.5, 5.0, 5.5, 5.5, 5.0, 6.0, 4...
$ `3_sens_fin` <dbl> 2.5, 3.0, 3.5, 2.5, 4.5, 4.5, 3.5, 4.5, 3.0, 5.5, 5.0, 3...
$ `3_stim_fin` <dbl> 3.5, 2.0, 3.0, 3.0, 2.0, 3.0, 2.5, NA, 2.5, 3.5, 3.5, 4....
$ `4_detach_fin` <dbl> 1.5, 1.0, 1.0, 1.0, 1.0, 1.5, 1.0, 1.0, 1.5, 1.0, 1.0, 1...
$ `4_intrus_fin` <dbl> 6.5, 5.5, 3.5, 5.0, 1.5, 4.0, 5.0, 4.5, 5.5, 1.0, 3.5, 3...
$ `4_negreg_fin` <dbl> 2.0, 1.5, 1.5, 1.0, 2.0, 2.5, 3.5, 1.0, 3.0, 1.0, 2.0, 2...
$ `4_posreg_fin` <dbl> 3.5, 5.5, 4.5, 6.0, 3.0, 4.0, 3.5, 5.5, 4.5, 6.0, 5.0, 4...
$ `4_sens_fin` <dbl> 2.0, 3.5, 4.0, 3.5, 4.0, 3.0, 2.5, 3.5, 2.5, 6.0, 3.5, 3...
$ `4_stim_fin` <dbl> 3.0, 3.0, 3.0, 4.0, 2.5, 2.0, 2.5, NA, 2.0, 4.5, 2.5, 3....
$ `5_detach_fin` <dbl> 1.0, 1.0, NA, 1.0, 1.0, 2.0, 1.0, 1.0, 1.5, 1.0, 3.0, 1....
$ `5_intrus_fin` <dbl> 4.5, 6.0, NA, 5.5, 3.0, 2.5, 5.5, 5.0, 5.5, 1.0, 2.0, 3....
$ `5_negreg_fin` <dbl> 1.0, 1.5, NA, 2.0, 1.0, 1.0, 1.5, 2.5, 3.5, 1.0, 2.0, 1....
$ `5_posreg_fin` <dbl> 5.0, 5.0, NA, 4.5, 3.5, 4.5, 4.5, 4.0, 4.0, 5.0, 4.0, 4....
$ `5_sens_fin` <dbl> 3.5, 3.0, NA, 3.0, 3.0, 4.0, 3.0, 3.0, 2.5, 6.0, 2.5, 4....
$ `5_stim_fin` <dbl> 3.5, 2.0, NA, 2.5, 2.0, 2.0, 2.5, NA, 2.0, 4.0, 2.0, 3.0...
$ `6_detach_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ `6_intrus_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ `6_negreg_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ `6_posreg_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ `6_sens_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ `6_stim_fin` <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ sens_M <dbl> 3.10, 3.80, 3.50, 2.90, 3.90, 4.30, 3.00, 3.50, 2.90, 5....
$ intrus_M <dbl> 5.100, 4.400, 4.625, 5.500, 1.800, 2.700, 4.500, 4.100, ...
$ posreg_M <dbl> 5.000, 5.700, 4.750, 5.500, 3.300, 5.100, 4.200, 5.100, ...
$ stim_M <dbl> 3.50, 2.90, 2.75, 3.20, 2.20, 2.80, 2.50, NaN, 2.60, 3.7...
$ detach_M <dbl> 1.100, 1.100, 1.125, 1.000, 1.000, 1.400, 2.200, 1.100, ...
$ negreg_M <dbl> 1.300, 1.200, 1.625, 1.300, 1.200, 1.300, 2.100, 1.300, ...
$ Factor1 <dbl> 0.41750725, 0.44482017, 0.22825145, 0.42940655, -0.99117...
$ Factor2 <dbl> 1.120033983, 0.582266698, 0.666892952, 1.544157232, -1.2...
$ Factor3 <dbl> -0.555330932, 0.492687275, -0.878599503, 0.209182110, -2...
$ Condition <chr> "ABTI", "CBTI", "ABTI", "CBTI", "ABTI", "ABTI", "ABTI", ...
$ ISI_total <int> 15, 9, 11, 1, 0, 5, 2, 4, 4, 2, 5, 2, 10, 8, 14, 0, 3, 2...
$ ISIP_total <int> NA, NA, NA, NA, NA, NA, NA, NA, NA, 1, NA, NA, 9, 3, 11,...
$ EPDS_total <int> 12, 4, 12, 4, 0, 6, 0, 1, 1, 0, 0, 1, 15, 1, 10, 3, 3, 8...
$ B_sleepnight <dbl> NA, 600, 600, 600, 600, 540, 480, 480, 480, 600, 540, 60...
$ B_sleepday <dbl> NA, 180, 270, 180, 300, 330, 360, 240, 480, 240, 180, 90...
$ B_nightwakeful <dbl> NA, 90, 10, 30, 5, 5, 10, 20, 150, 0, 15, 20, 20, 120, 1...
$ B_gotosleep <dbl> NA, 120, 0, 45, 20, 30, 20, 20, 20, 30, 30, 15, 60, 30, ...
$ analysis_name <chr> "BS_6.16.17", "BS_6.16.17", "11016_3_01.25.18", NA, "110...
$ data_start_date <chr> "11/12/13", "12/5/13", "5/29/14", NA, "7/18/14", "7/28/1...
$ data_start_time <time> 11:15:00, 14:09:00, 12:31:00, NA, 09:34:00, 12:24...
$ interval_type <chr> "Sleep Summary", "Sleep Summary", "Sleep Summary", NA, "...
$ start_date <dbl> NaN, NaN, NaN, NA, NaN, NaN, NA, NaN, NaN, NaN, NaN, NaN...
$ start_time <dbl> NaN, NaN, NaN, NA, NaN, NaN, NA, NaN, NaN, NaN, NaN, NaN...
$ end_date <dbl> NaN, NaN, NaN, NA, NaN, NaN, NA, NaN, NaN, NaN, NaN, NaN...
$ end_time <dbl> NaN, NaN, NaN, NA, NaN, NaN, NA, NaN, NaN, NaN, NaN, NaN...
$ `Average(n)_avg_sleep_b` <dbl> 10.75, 24.35, 19.68, NA, 35.61, 32.23, NA, 33.00, 18.12,...
$ `Average(n)_avg_wake_b` <dbl> 3.92, 2.35, 3.26, NA, 1.79, 3.32, NA, 2.62, 2.60, 1.70, ...
$ `Average(n)_duration` <dbl> 361.29, 512.57, 399.43, NA, 514.17, 471.50, NA, 459.86, ...
$ mean_efficiency <dbl> 63.08, 84.85, 69.08, NA, 93.18, 84.08, NA, 82.11, 81.67,...
$ `Average(n)_number_of_sleep_bouts` <dbl> 25.43, 20.57, 17.71, NA, 14.67, 13.92, NA, 14.86, 25.88,...
$ `Average(n)_number_of_wake_bouts` <dbl> 25.14, 20.29, 17.29, NA, 13.83, 13.17, NA, 14.43, 25.00,...
$ `Average(n)_onset_latency` <dbl> 15.86, 23.43, 46.29, NA, 2.67, 16.75, NA, 26.29, 22.88, ...
$ `Average(n)_percent_invalid_sw` <dbl> 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
$ `Average(n)_percent_sleep` <dbl> 73.21, 90.20, 86.66, NA, 95.35, 90.58, NA, 89.71, 87.87,...
$ `Average(n)_percent_wake` <dbl> 26.79, 9.80, 13.34, NA, 4.65, 9.42, NA, 10.29, 12.13, 6....
$ mean_sleep_time <dbl> 261.57, 462.71, 344.29, NA, 490.17, 426.42, NA, 415.29, ...
$ mean_wake_time <dbl> 99.71, 49.86, 55.14, NA, 24.00, 45.08, NA, 44.57, 61.88,...
$ `Average(n)_waso` <dbl> 99.71, 49.86, 55.14, NA, 24.00, 45.08, NA, 44.57, 61.88,...
$ `Maximum(n)_avg_sleep_b` <dbl> 17.41, 36.36, 25.21, NA, 55.13, 46.64, NA, 52.75, 25.00,...
$ `Maximum(n)_avg_wake_b` <dbl> 6.44, 3.46, 5.72, NA, 2.23, 8.12, NA, 6.50, 5.82, 2.11, ...
$ `Maximum(n)_duration` <dbl> 474, 559, 582, NA, 556, 558, NA, 553, 594, 541, 691, 482...
$ `Maximum(n)_efficiency` <dbl> 72.54, 93.76, 76.38, NA, 94.68, 92.46, NA, 92.34, 89.85,...
$ `Maximum(n)_number_of_sleep_bouts` <dbl> 31, 28, 20, NA, 19, 18, NA, 25, 33, 20, 16, 29, 32, 28, ...
$ `Maximum(n)_number_of_wake_bouts` <dbl> 31, 28, 21, NA, 18, 17, NA, 24, 32, 20, 15, 30, 31, 28, ...
$ `Maximum(n)_onset_latency` <dbl> 62, 56, 167, NA, 12, 53, NA, 151, 61, 1, 21, 68, 0, 27, ...
$ `Maximum(n)_percent_invalid_sw` <dbl> 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
$ `Maximum(n)_percent_sleep` <dbl> 83.62, 95.20, 91.74, NA, 96.92, 95.69, NA, 97.24, 93.82,...
$ `Maximum(n)_percent_wake` <dbl> 36.98, 19.48, 17.70, NA, 6.25, 27.54, NA, 39.39, 21.15, ...
$ `Maximum(n)_sleep_time` <dbl> 300, 524, 479, NA, 534, 513, NA, 513, 537, 517, 643, 431...
$ `Maximum(n)_wake_time` <dbl> 174, 97, 103, NA, 31, 138, NA, 156, 99, 34, 60, 157, 127...
$ `Maximum(n)_waso` <dbl> 174, 97, 103, NA, 31, 138, NA, 156, 99, 34, 60, 157, 127...
$ `Minimum(n)_avg_sleep_b` <dbl> 7.84, 14.32, 15.10, NA, 24.84, 20.17, NA, 9.60, 14.29, 1...
$ `Minimum(n)_avg_wake_b` <dbl> 2.56, 1.67, 1.67, NA, 1.28, 2.00, NA, 1.67, 1.65, 1.40, ...
$ `Minimum(n)_duration` <dbl> 297, 449, 279, NA, 455, 378, NA, 394, 443, 328, 464, 410...
$ `Minimum(n)_efficiency` <dbl> 50.42, 72.12, 43.17, NA, 90.29, 66.61, NA, 43.80, 70.29,...
$ `Minimum(n)_number_of_sleep_bouts` <dbl> 17, 14, 11, NA, 8, 9, NA, 8, 17, 10, 3, 8, 32, 16, 3, 15...
$ `Minimum(n)_number_of_wake_bouts` <dbl> 17, 14, 11, NA, 7, 9, NA, 7, 17, 9, 3, 8, 31, 15, 2, 15,...
$ `Minimum(n)_onset_latency` <dbl> 0, 1, 0, NA, 0, 0, NA, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, ...
$ `Minimum(n)_percent_invalid_sw` <dbl> 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
$ `Minimum(n)_percent_sleep` <dbl> 63.02, 80.52, 82.30, NA, 93.75, 72.46, NA, 60.61, 78.85,...
$ `Minimum(n)_percent_wake` <dbl> 16.38, 4.80, 8.26, NA, 3.08, 4.31, NA, 2.76, 6.18, 4.44,...
$ `Minimum(n)_sleep_time` <dbl> 235, 401, 240, NA, 441, 349, NA, 240, 369, 307, 461, 263...
$ `Minimum(n)_wake_time` <dbl> 58, 25, 30, NA, 14, 18, NA, 12, 28, 19, 3, 23, 127, 22, ...
$ `Minimum(n)_waso` <dbl> 58, 25, 30, NA, 14, 18, NA, 12, 28, 19, 3, 23, 127, 22, ...
$ n_avg_sleep_b <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_avg_wake_b <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_duration <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_efficiency <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_number_of_sleep_bouts <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_number_of_wake_bouts <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_onset_latency <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_percent_invalid_sw <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_percent_sleep <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_percent_wake <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_sleep_time <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_wake_time <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ n_waso <dbl> 7, 7, 7, NA, 6, 12, NA, 7, 8, 6, 5, 7, 1, 7, 7, 7, 7, 6,...
$ `Std Dev(n-1)_avg_sleep_b` <dbl> 3.15, 8.00, 3.40, NA, 10.54, 8.53, NA, 15.04, 3.73, 7.52...
$ `Std Dev(n-1)_avg_wake_b` <dbl> 1.45, 0.64, 1.50, NA, 0.41, 1.68, NA, 1.73, 1.33, 0.24, ...
$ `Std Dev(n-1)_duration` <dbl> 57.51, 36.82, 98.69, NA, 39.15, 51.15, NA, 57.07, 54.48,...
$ `Std Dev(n-1)_efficiency` <dbl> 7.44, 7.44, 11.66, NA, 1.81, 7.97, NA, 17.18, 6.36, 4.87...
$ `Std Dev(n-1)_number_of_sleep_bouts` <dbl> 4.89, 5.88, 3.45, NA, 3.72, 3.12, NA, 6.07, 6.53, 3.27, ...
$ `Std Dev(n-1)_number_of_wake_bouts` <dbl> 4.78, 6.18, 3.55, NA, 3.87, 2.95, NA, 6.00, 6.35, 3.73, ...
$ `Std Dev(n-1)_onset_latency` <dbl> 22.09, 21.25, 58.46, NA, 4.59, 16.31, NA, 55.31, 23.12, ...
$ `Std Dev(n-1)_percent_invalid_sw` <dbl> 0, 0, 0, NA, 0, 0, NA, 0, 0, 0, 0, 0, NaN, 0, 0, 0, 0, 0...
$ `Std Dev(n-1)_percent_sleep` <dbl> 8.10, 5.41, 3.69, NA, 1.08, 6.03, NA, 12.98, 4.45, 1.49,...
$ `Std Dev(n-1)_percent_wake` <dbl> 8.10, 5.41, 3.69, NA, 1.08, 6.03, NA, 12.98, 4.45, 1.49,...
$ `Std Dev(n-1)_sleep_time` <dbl> 26.50, 48.24, 74.86, NA, 36.42, 49.63, NA, 88.66, 54.85,...
$ `Std Dev(n-1)_wake_time` <dbl> 44.26, 27.11, 27.33, NA, 6.00, 31.06, NA, 50.30, 21.22, ...
$ `Std Dev(n-1)_waso` <dbl> 44.26, 27.11, 27.33, NA, 6.00, 31.06, NA, 50.30, 21.22, ...
glimpse(data_lf)
Observations: 334
Variables: 94
$ ID <dbl> 11002, 11002, 11002, 11002, 11002, 11004, 11004, 11004, ...
$ Episode <dbl> 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4,...
$ sens_fin <dbl> 4.0, 3.5, 2.5, 2.0, 3.5, 4.5, 5.0, 3.0, 3.5, 3.0, 3.5, 3...
$ intrus_fin <dbl> 3.5, 5.0, 6.0, 6.5, 4.5, 2.0, 2.5, 6.0, 5.5, 6.0, 5.0, 5...
$ posreg_fin <dbl> 5.5, 6.0, 5.0, 3.5, 5.0, 6.0, 6.0, 6.0, 5.5, 5.0, 5.0, 4...
$ stim_fin <dbl> 3.5, 4.0, 3.5, 3.0, 3.5, 3.0, 4.5, 2.0, 3.0, 2.0, 3.0, 2...
$ detach_fin <dbl> 1.0, 1.0, 1.0, 1.5, 1.0, 1.0, 1.0, 1.5, 1.0, 1.0, 1.0, 1...
$ negreg_fin <dbl> 1.0, 1.0, 1.5, 2.0, 1.0, 1.0, 1.0, 1.0, 1.5, 1.5, 1.5, 2...
$ Condition <chr> "ABTI", "ABTI", "ABTI", "ABTI", "ABTI", "CBTI", "CBTI", ...
$ ISI_total <int> 15, 15, 15, 15, 15, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11, 1...
$ ISIP_total <int> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, ...
$ EPDS_total <int> 12, 12, 12, 12, 12, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 4...
$ B_sleepnight <dbl> NA, NA, NA, NA, NA, 600, 600, 600, 600, 600, 600, 600, 6...
$ B_sleepday <dbl> NA, NA, NA, NA, NA, 180, 180, 180, 180, 180, 270, 270, 2...
$ B_nightwakeful <dbl> NA, NA, NA, NA, NA, 90, 90, 90, 90, 90, 10, 10, 10, 10, ...
$ B_gotosleep <dbl> NA, NA, NA, NA, NA, 120, 120, 120, 120, 120, 0, 0, 0, 0,...
$ analysis_name <chr> "BS_6.16.17", "BS_6.16.17", "BS_6.16.17", "BS_6.16.17", ...
$ data_start_date <chr> "11/12/13", "11/12/13", "11/12/13", "11/12/13", "11/12/1...
$ data_start_time <time> 11:15:00, 11:15:00, 11:15:00, 11:15:00, 11:15:00, 14:09...
$ interval_type <chr> "Sleep Summary", "Sleep Summary", "Sleep Summary", "Slee...
$ start_date <dbl> NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, N...
$ start_time <dbl> NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, N...
$ end_date <dbl> NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, N...
$ end_time <dbl> NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, N...
$ `Average(n)_avg_sleep_b` <dbl> 10.75, 10.75, 10.75, 10.75, 10.75, 24.35, 24.35, 24.35, ...
$ `Average(n)_avg_wake_b` <dbl> 3.92, 3.92, 3.92, 3.92, 3.92, 2.35, 2.35, 2.35, 2.35, 2....
$ `Average(n)_duration` <dbl> 361.29, 361.29, 361.29, 361.29, 361.29, 512.57, 512.57, ...
$ mean_efficiency <dbl> 63.08, 63.08, 63.08, 63.08, 63.08, 84.85, 84.85, 84.85, ...
$ `Average(n)_number_of_sleep_bouts` <dbl> 25.43, 25.43, 25.43, 25.43, 25.43, 20.57, 20.57, 20.57, ...
$ `Average(n)_number_of_wake_bouts` <dbl> 25.14, 25.14, 25.14, 25.14, 25.14, 20.29, 20.29, 20.29, ...
$ `Average(n)_onset_latency` <dbl> 15.86, 15.86, 15.86, 15.86, 15.86, 23.43, 23.43, 23.43, ...
$ `Average(n)_percent_invalid_sw` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA,...
$ `Average(n)_percent_sleep` <dbl> 73.21, 73.21, 73.21, 73.21, 73.21, 90.20, 90.20, 90.20, ...
$ `Average(n)_percent_wake` <dbl> 26.79, 26.79, 26.79, 26.79, 26.79, 9.80, 9.80, 9.80, 9.8...
$ mean_sleep_time <dbl> 261.57, 261.57, 261.57, 261.57, 261.57, 462.71, 462.71, ...
$ mean_wake_time <dbl> 99.71, 99.71, 99.71, 99.71, 99.71, 49.86, 49.86, 49.86, ...
$ `Average(n)_waso` <dbl> 99.71, 99.71, 99.71, 99.71, 99.71, 49.86, 49.86, 49.86, ...
$ `Maximum(n)_avg_sleep_b` <dbl> 17.41, 17.41, 17.41, 17.41, 17.41, 36.36, 36.36, 36.36, ...
$ `Maximum(n)_avg_wake_b` <dbl> 6.44, 6.44, 6.44, 6.44, 6.44, 3.46, 3.46, 3.46, 3.46, 3....
$ `Maximum(n)_duration` <dbl> 474, 474, 474, 474, 474, 559, 559, 559, 559, 559, 582, 5...
$ `Maximum(n)_efficiency` <dbl> 72.54, 72.54, 72.54, 72.54, 72.54, 93.76, 93.76, 93.76, ...
$ `Maximum(n)_number_of_sleep_bouts` <dbl> 31, 31, 31, 31, 31, 28, 28, 28, 28, 28, 20, 20, 20, 20, ...
$ `Maximum(n)_number_of_wake_bouts` <dbl> 31, 31, 31, 31, 31, 28, 28, 28, 28, 28, 21, 21, 21, 21, ...
$ `Maximum(n)_onset_latency` <dbl> 62, 62, 62, 62, 62, 56, 56, 56, 56, 56, 167, 167, 167, 1...
$ `Maximum(n)_percent_invalid_sw` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA,...
$ `Maximum(n)_percent_sleep` <dbl> 83.62, 83.62, 83.62, 83.62, 83.62, 95.20, 95.20, 95.20, ...
$ `Maximum(n)_percent_wake` <dbl> 36.98, 36.98, 36.98, 36.98, 36.98, 19.48, 19.48, 19.48, ...
$ `Maximum(n)_sleep_time` <dbl> 300, 300, 300, 300, 300, 524, 524, 524, 524, 524, 479, 4...
$ `Maximum(n)_wake_time` <dbl> 174, 174, 174, 174, 174, 97, 97, 97, 97, 97, 103, 103, 1...
$ `Maximum(n)_waso` <dbl> 174, 174, 174, 174, 174, 97, 97, 97, 97, 97, 103, 103, 1...
$ `Minimum(n)_avg_sleep_b` <dbl> 7.84, 7.84, 7.84, 7.84, 7.84, 14.32, 14.32, 14.32, 14.32...
$ `Minimum(n)_avg_wake_b` <dbl> 2.56, 2.56, 2.56, 2.56, 2.56, 1.67, 1.67, 1.67, 1.67, 1....
$ `Minimum(n)_duration` <dbl> 297, 297, 297, 297, 297, 449, 449, 449, 449, 449, 279, 2...
$ `Minimum(n)_efficiency` <dbl> 50.42, 50.42, 50.42, 50.42, 50.42, 72.12, 72.12, 72.12, ...
$ `Minimum(n)_number_of_sleep_bouts` <dbl> 17, 17, 17, 17, 17, 14, 14, 14, 14, 14, 11, 11, 11, 11, ...
$ `Minimum(n)_number_of_wake_bouts` <dbl> 17, 17, 17, 17, 17, 14, 14, 14, 14, 14, 11, 11, 11, 11, ...
$ `Minimum(n)_onset_latency` <dbl> 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, NA, NA, NA,...
$ `Minimum(n)_percent_invalid_sw` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA,...
$ `Minimum(n)_percent_sleep` <dbl> 63.02, 63.02, 63.02, 63.02, 63.02, 80.52, 80.52, 80.52, ...
$ `Minimum(n)_percent_wake` <dbl> 16.38, 16.38, 16.38, 16.38, 16.38, 4.80, 4.80, 4.80, 4.8...
$ `Minimum(n)_sleep_time` <dbl> 235, 235, 235, 235, 235, 401, 401, 401, 401, 401, 240, 2...
$ `Minimum(n)_wake_time` <dbl> 58, 58, 58, 58, 58, 25, 25, 25, 25, 25, 30, 30, 30, 30, ...
$ `Minimum(n)_waso` <dbl> 58, 58, 58, 58, 58, 25, 25, 25, 25, 25, 30, 30, 30, 30, ...
$ n_avg_sleep_b <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_avg_wake_b <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_duration <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_efficiency <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_number_of_sleep_bouts <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_number_of_wake_bouts <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_onset_latency <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_percent_invalid_sw <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_percent_sleep <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_percent_wake <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_sleep_time <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_wake_time <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ n_waso <dbl> 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, NA, NA, NA,...
$ `Std Dev(n-1)_avg_sleep_b` <dbl> 3.15, 3.15, 3.15, 3.15, 3.15, 8.00, 8.00, 8.00, 8.00, 8....
$ `Std Dev(n-1)_avg_wake_b` <dbl> 1.45, 1.45, 1.45, 1.45, 1.45, 0.64, 0.64, 0.64, 0.64, 0....
$ `Std Dev(n-1)_duration` <dbl> 57.51, 57.51, 57.51, 57.51, 57.51, 36.82, 36.82, 36.82, ...
$ `Std Dev(n-1)_efficiency` <dbl> 7.44, 7.44, 7.44, 7.44, 7.44, 7.44, 7.44, 7.44, 7.44, 7....
$ `Std Dev(n-1)_number_of_sleep_bouts` <dbl> 4.89, 4.89, 4.89, 4.89, 4.89, 5.88, 5.88, 5.88, 5.88, 5....
$ `Std Dev(n-1)_number_of_wake_bouts` <dbl> 4.78, 4.78, 4.78, 4.78, 4.78, 6.18, 6.18, 6.18, 6.18, 6....
$ `Std Dev(n-1)_onset_latency` <dbl> 22.09, 22.09, 22.09, 22.09, 22.09, 21.25, 21.25, 21.25, ...
$ `Std Dev(n-1)_percent_invalid_sw` <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA,...
$ `Std Dev(n-1)_percent_sleep` <dbl> 8.10, 8.10, 8.10, 8.10, 8.10, 5.41, 5.41, 5.41, 5.41, 5....
$ `Std Dev(n-1)_percent_wake` <dbl> 8.10, 8.10, 8.10, 8.10, 8.10, 5.41, 5.41, 5.41, 5.41, 5....
$ `Std Dev(n-1)_sleep_time` <dbl> 26.50, 26.50, 26.50, 26.50, 26.50, 48.24, 48.24, 48.24, ...
$ `Std Dev(n-1)_wake_time` <dbl> 44.26, 44.26, 44.26, 44.26, 44.26, 27.11, 27.11, 27.11, ...
$ `Std Dev(n-1)_waso` <dbl> 44.26, 44.26, 44.26, 44.26, 44.26, 27.11, 27.11, 27.11, ...
$ episode_re <int> 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3,...
$ wake_time_grp <chr> "higher", "higher", "higher", "higher", "higher", "lower...
$ efficiency_grp <chr> "lower", "lower", "lower", "lower", "lower", "higher", "...
$ ISI_grp <chr> "higher", "higher", "higher", "higher", "higher", "highe...
$ ISIP_grp <chr> "higher", "higher", "higher", "higher", "higher", "highe...
corr_data_wf <- data_wf %>%
select(
ISI_total,
ISIP_total,
EPDS_total,
mean_wake_time,
mean_sleep_time,
mean_efficiency,
B_nightwakeful,
B_sleepnight,
B_gotosleep,
B_sleepday,
Factor1,
Factor2,
Factor3,
sens_M,
intrus_M
)
corr_data_wf <- cor(corr_data_wf, use = "pairwise.complete.obs")
Actigraphy measure of maternal sleep time is not associated with either version of the ISI; however, measure of time awake is positively associated with both of these measures.
plot_trajectories_id(data_lf, episode_re, sens_fin)
##treatment arm
plot_trajectories_id(data_lf, episode_re, sens_fin) +
facet_grid(~Condition)
plot_trajectories(data_lf, episode_re, sens_fin, Condition, method = "loess")
##wake time
plot_trajectories(
data_lf %>%
filter(!is.na(wake_time_grp)),
episode_re,
sens_fin,
wake_time_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
##efficiency
plot_trajectories(
data_lf %>%
filter(!is.na(efficiency_grp)),
episode_re,
sens_fin,
efficiency_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
plot_trajectories_id(data_lf, episode_re, intrus_fin)
##treatment arm
plot_trajectories_id(data_lf, episode_re, intrus_fin) +
facet_grid(~Condition)
plot_trajectories(data_lf, episode_re, intrus_fin, Condition, method = "loess")
##wake time
plot_trajectories(
data_lf %>%
filter(!is.na(wake_time_grp)),
episode_re,
intrus_fin,
wake_time_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
##efficiency
plot_trajectories(
data_lf %>%
filter(!is.na(efficiency_grp)),
episode_re,
intrus_fin,
efficiency_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
plot_trajectories_id(data_lf, episode_re, stim_fin)
##treatment arm
plot_trajectories_id(data_lf, episode_re, stim_fin) +
facet_grid(~Condition)
plot_trajectories(data_lf, episode_re, stim_fin, Condition, method = "loess")
##wake time
plot_trajectories(
data_lf %>%
filter(!is.na(wake_time_grp)),
episode_re,
stim_fin,
wake_time_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
##efficiency
plot_trajectories(
data_lf %>%
filter(!is.na(efficiency_grp)),
episode_re,
stim_fin,
efficiency_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
##insomnia severity
plot_trajectories(
data_lf %>%
filter(!is.na(ISI_grp)),
episode_re,
sens_fin,
ISI_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
##postpartum insomnia severity
plot_trajectories(
data_lf %>%
filter(!is.na(ISIP_grp)),
episode_re,
sens_fin,
ISIP_grp,
method = "loess"
) +
theme(
aspect.ratio = 1
)
sens_ml_1 <- lmer(sens_fin ~ Episode + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_1)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ Episode + (1 | ID)
Data: data_lf
REML criterion at convergence: 751.5
Scaled residuals:
Min 1Q Median 3Q Max
-2.9126 -0.5782 -0.0674 0.6073 3.3244
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.7735 0.8795
Residual 0.3340 0.5779
Number of obs: 331, groups: ID, 67
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.94409 0.13072 118.41920 30.171 < 2e-16 ***
Episode -0.07689 0.02266 263.33712 -3.393 0.000798 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr)
Episode -0.515
sens_ml_2 <- lmer(sens_fin ~ Episode + (Episode|ID), REML = TRUE, data = data_lf)
summary(sens_ml_2)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ Episode + (Episode | ID)
Data: data_lf
REML criterion at convergence: 727.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.1995 -0.5539 -0.0203 0.5598 2.4362
Random effects:
Groups Name Variance Std.Dev. Corr
ID (Intercept) 0.76140 0.8726
Episode 0.03381 0.1839 -0.28
Residual 0.25163 0.5016
Number of obs: 331, groups: ID, 67
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.94757 0.12474 66.23653 31.647 <2e-16 ***
Episode -0.07863 0.02994 65.82245 -2.627 0.0107 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr)
Episode -0.491
ICC_intercept = .7612 / (.7612 + .3327)
ICC_intercept
[1] 0.6958589
ICC_slope = .03292 / (.74591 + .25163 + .03292)
ICC_slope
[1] 0.0319469
Slope ICC is very low. Will not include in models.
sens_ml_3 <- lmer(sens_fin ~ episode_re + mean_wake_time + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_3)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re + mean_wake_time + (1 | ID)
Data: data_lf
REML criterion at convergence: 653.3
Scaled residuals:
Min 1Q Median 3Q Max
-2.8461 -0.5808 -0.0710 0.6238 3.2206
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.6947 0.8335
Residual 0.3492 0.5909
Number of obs: 282, groups: ID, 57
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 4.387178 0.286909 58.330525 15.291 < 2e-16 ***
episode_re -0.077549 0.025075 224.280432 -3.093 0.00224 **
mean_wake_time -0.008019 0.004507 54.971327 -1.779 0.08073 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r
episode_re -0.169
mean_wak_tm -0.898 -0.003
sens_ml_4 <- lmer(sens_fin ~ episode_re * mean_wake_time + (1|ID), REML = TRUE, data = data_lf)
sens_ml_5 <- lmer(sens_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1 | ID)
Data: data_lf
REML criterion at convergence: 660.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.8475 -0.6000 -0.0284 0.6336 3.3263
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.6951 0.8337
Residual 0.3436 0.5861
Number of obs: 282, groups: ID, 57
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.927e+00 1.258e-01 7.598e+01 31.216 < 2e-16 ***
episode_re -7.687e-02 2.488e-02 2.233e+02 -3.090 0.00225 **
scale(mean_wake_time, scale = FALSE) -3.874e-03 4.893e-03 7.591e+01 -0.792 0.43100
episode_re:scale(mean_wake_time, scale = FALSE) -2.087e-03 9.619e-04 2.232e+02 -2.170 0.03108 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r s(_s=F
episode_re -0.390
s(__,s=FALS 0.003 0.002
e_:(__,s=FA 0.002 -0.013 -0.390
johnson_neyman(model = sens_ml_4, pred = episode_re, modx = mean_wake_time)
[1m[4mJOHNSON-NEYMAN INTERVAL[24m[22m
When mean_wake_time is [7mOUTSIDE[27m the interval [-351.16, 46.14], the slope of episode_re is p
< .05.
[3mNote: The range of observed values of mean_wake_time is [23m[17.67, 138.50]
intrus_ml_1 <- lmer(intrus_fin ~ episode_re + mean_wake_time + (1|ID), REML = TRUE, data = data_lf)
summary(intrus_ml_1)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: intrus_fin ~ episode_re + mean_wake_time + (1 | ID)
Data: data_lf
REML criterion at convergence: 873.6
Scaled residuals:
Min 1Q Median 3Q Max
-2.67203 -0.57194 -0.01982 0.59396 2.62547
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 1.2915 1.1365
Residual 0.7975 0.8931
Number of obs: 282, groups: ID, 57
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.483e+00 3.965e-01 5.899e+01 6.263 4.71e-08 ***
episode_re 1.297e-01 3.789e-02 2.243e+02 3.423 0.000736 ***
mean_wake_time 4.956e-03 6.210e-03 5.494e+01 0.798 0.428229
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r
episode_re -0.185
mean_wak_tm -0.896 -0.004
sens_ml_5 <- lmer(intrus_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: intrus_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1 | ID)
Data: data_lf
REML criterion at convergence: 882.2
Scaled residuals:
Min 1Q Median 3Q Max
-2.70380 -0.57587 0.01841 0.58062 2.60660
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 1.2931 1.1372
Residual 0.7915 0.8897
Number of obs: 282, groups: ID, 57
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 2.768e+00 1.762e-01 8.065e+01 15.706 < 2e-16 ***
episode_re 1.289e-01 3.776e-02 2.233e+02 3.415 0.000757 ***
scale(mean_wake_time, scale = FALSE) 2.047e-04 6.854e-03 8.057e+01 0.030 0.976247
episode_re:scale(mean_wake_time, scale = FALSE) 2.392e-03 1.460e-03 2.232e+02 1.639 0.102692
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r s(_s=F
episode_re -0.423
s(__,s=FALS 0.003 0.002
e_:(__,s=FA 0.002 -0.013 -0.423
stim_ml_1 <- lmer(stim_fin ~ episode_re + mean_wake_time + (1|ID), REML = TRUE, data = data_lf)
summary(stim_ml_1)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: stim_fin ~ episode_re + mean_wake_time + (1 | ID)
Data: data_lf
REML criterion at convergence: 548.1
Scaled residuals:
Min 1Q Median 3Q Max
-2.42828 -0.56784 -0.03077 0.53039 2.88986
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.5538 0.7442
Residual 0.2769 0.5263
Number of obs: 262, groups: ID, 53
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.330566 0.264805 54.052543 12.577 < 2e-16 ***
episode_re -0.065119 0.023183 208.244551 -2.809 0.00544 **
mean_wake_time -0.002921 0.004128 50.939234 -0.708 0.48245
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r
episode_re -0.169
mean_wak_tm -0.898 -0.004
stim_ml_5 <- lmer(stim_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1|ID), REML = TRUE, data = data_lf)
summary(stim_ml_5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: stim_fin ~ episode_re * scale(mean_wake_time, scale = FALSE) + (1 | ID)
Data: data_lf
REML criterion at convergence: 559.5
Scaled residuals:
Min 1Q Median 3Q Max
-2.32778 -0.54639 -0.02948 0.55324 2.90093
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.5531 0.7437
Residual 0.2772 0.5265
Number of obs: 262, groups: ID, 53
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.162e+00 1.166e-01 7.068e+01 27.125 < 2e-16 ***
episode_re -6.449e-02 2.320e-02 2.073e+02 -2.779 0.00595 **
scale(mean_wake_time, scale = FALSE) -1.306e-03 4.486e-03 7.061e+01 -0.291 0.77190
episode_re:scale(mean_wake_time, scale = FALSE) -8.140e-04 8.872e-04 2.071e+02 -0.918 0.35993
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r s(_s=F
episode_re -0.392
s(__,s=FALS -0.013 0.008
e_:(__,s=FA 0.008 -0.029 -0.393
sens_ml_6 <- lmer(sens_fin ~ episode_re + ISI_total + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_6)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re + ISI_total + (1 | ID)
Data: data_lf
REML criterion at convergence: 748.5
Scaled residuals:
Min 1Q Median 3Q Max
-2.9180 -0.6178 -0.0584 0.6324 3.2871
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.7767 0.8813
Residual 0.3381 0.5815
Number of obs: 326, groups: ID, 66
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 4.05916 0.19899 71.04873 20.399 < 2e-16 ***
episode_re -0.07721 0.02298 259.31256 -3.360 0.000896 ***
ISI_total -0.02560 0.02196 64.00907 -1.166 0.247975
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r
episode_re -0.225
ISI_total -0.790 -0.003
sens_ml_7 <- lmer(sens_fin ~ episode_re * scale(ISI_total, scale = FALSE) + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_7)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re * scale(ISI_total, scale = FALSE) + (1 | ID)
Data: data_lf
REML criterion at convergence: 757.3
Scaled residuals:
Min 1Q Median 3Q Max
-2.8780 -0.6175 -0.0626 0.6313 3.3048
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.7763 0.8811
Residual 0.3393 0.5825
Number of obs: 326, groups: ID, 66
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.875127 0.121908 85.686234 31.787 < 2e-16 ***
episode_re -0.077093 0.023019 258.317516 -3.349 0.000932 ***
scale(ISI_total, scale = FALSE) -0.022420 0.023652 85.671387 -0.948 0.345834
episode_re:scale(ISI_total, scale = FALSE) -0.001612 0.004460 258.293306 -0.361 0.718052
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r s(Is=F
episode_re -0.372
s(ISI_,s=FA 0.003 0.002
e_:(ISI_s=F 0.002 -0.014 -0.372
sens_ml_8 <- lmer(sens_fin ~ episode_re + ISIP_total + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_8)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re + ISIP_total + (1 | ID)
Data: data_lf
REML criterion at convergence: 627
Scaled residuals:
Min 1Q Median 3Q Max
-2.8979 -0.6069 -0.0724 0.6142 3.3858
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.8690 0.9322
Residual 0.3323 0.5764
Number of obs: 272, groups: ID, 55
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 4.10438 0.19275 60.42897 21.294 <2e-16 ***
episode_re -0.05688 0.02492 216.17119 -2.283 0.0234 *
ISIP_total -0.05215 0.03078 52.96140 -1.694 0.0961 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r
episode_re -0.252
ISIP_total -0.690 -0.004
sens_ml_9 <- lmer(sens_fin ~ episode_re * scale(ISIP_total, scale = FALSE) + (1|ID), REML = TRUE, data = data_lf)
summary(sens_ml_9)
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: sens_fin ~ episode_re * scale(ISIP_total, scale = FALSE) + (1 | ID)
Data: data_lf
REML criterion at convergence: 634.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.8244 -0.5975 -0.0645 0.6143 3.4208
Random effects:
Groups Name Variance Std.Dev.
ID (Intercept) 0.8681 0.9317
Residual 0.3329 0.5770
Number of obs: 272, groups: ID, 55
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 3.877553 0.139400 68.799482 27.816 <2e-16 ***
episode_re -0.056487 0.024946 215.177942 -2.264 0.0245 *
scale(ISIP_total, scale = FALSE) -0.043065 0.032885 68.776914 -1.310 0.1947
episode_re:scale(ISIP_total, scale = FALSE) -0.004594 0.005869 215.139917 -0.783 0.4346
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) epsd_r s(Is=F
episode_re -0.353
s(ISIP_,s=F 0.003 0.003
e_:(ISIPs=F 0.003 -0.020 -0.353
data_wf %>%
group_by(Condition) %>%
summarise_at(
vars(
ISI_total,
ISIP_total,
mean_wake_time,
mean_efficiency,
mean_sleep_time,
sens_M:negreg_M
),
funs(mean),
na.rm = TRUE
)
No substantial differences across actigraphy, self-report, or observational measures between though who received CBTI vs. ABTI.
library(lcmm)
lcmm_sens_df <-
data_lf %>%
select(
ID,
episode_re,
sens_fin
) %>%
mutate(
ID = as.character(ID)
)
lcmm_sens <-
lcmm(sens_fin~episode_re, random = ~episode_re, subject = "ID", mixture = ~episode_re, ng = 2, idiag = TRUE, data = lcmm_sens_df, link = "linear")
Be patient, lcmm is running ...
The program took 0.07 seconds
summary(lcmm_sens)
General latent class mixed model
fitted by maximum likelihood method
lcmm(fixed = sens_fin ~ episode_re, mixture = ~episode_re, random = ~episode_re,
subject = "ID", ng = 2, idiag = TRUE, link = "linear", data = lcmm_sens_df)
Statistical Model:
Dataset: lcmm_sens_df
Number of subjects: 67
Number of observations: 331
Number of observations deleted: 3
Number of latent classes: 2
Number of parameters: 8
Link function: linear
Iteration process:
Convergence criteria satisfied
Number of iterations: 13
Convergence criteria: parameters= 9.2e-07
: likelihood= 9.3e-07
: second derivatives= 4.3e-12
Goodness-of-fit statistics:
maximum log-likelihood: -358.96
AIC: 733.92
BIC: 751.55
Maximum Likelihood Estimates:
Fixed effects in the class-membership model:
(the class of reference is the last class)
coef Se Wald p-value
intercept class1 -0.68692 0.72539 -0.947 0.34365
Fixed effects in the longitudinal model:
coef Se Wald p-value
intercept class1 (not estimated) 0
intercept class2 -2.67637 0.53010 -5.049 0.00000
episode_re class1 -0.22021 0.16321 -1.349 0.17726
episode_re class2 -0.12519 0.10202 -1.227 0.21976
Variance-covariance matrix of the random-effects:
intercept episode_re
intercept 1.19
episode_re 0.00 0.13253
Residual standard error (not estimated) = 1
Parameters of the link function:
coef Se Wald p-value
Linear 1 (intercept) 4.76027 0.27378 17.387 0.00000
Linear 2 (std err) 0.50062 0.02592 19.317 0.00000
postprob(lcmm_sens)
Posterior classification:
class1 class2
N 22.00 45.00
% 32.84 67.16
Posterior classification table:
--> mean of posterior probabilities in each class
prob1 prob2
class1 0.7887 0.2113
class2 0.1128 0.8872
Posterior probabilities above a threshold (%):
class1 class2
prob>0.7 59.09 84.44
prob>0.8 45.45 77.78
prob>0.9 36.36 64.44
NOTES: DUKE awakenings (amount of time awake) from mom and due to infant early childhood adversity look at variability in sensitivity